#include "color.h"

Color::Color():m_red(0),m_green(0),m_blue(0),m_opacity(0)
{
}
Color::Color(Uint8 red,Uint8 green,Uint8 blue,Uint8 opacity=255):m_red(red),
  m_green(green),m_blue(blue),m_opacity(opacity)
{
}
Color::Color(float red,float green,float blue,float opacity=1)
{
}
Color::Color(Color& c):m_red(c.m_red),m_green(c.m_green),m_blue(c.blue),m_opacity(c.opacity)
{
}

Uint8 Color::getIntRed()
{
  return m_red;
}

Uint8 Color::getIntGreen()
{
  return m_green;
}

Uint8 Color::getIntBlue()
{
  return m_blue;
}

Uint8 Color::getIntOpacity()
{
  return m_opacity;
}

float Color::getFloatRed()
{
  return (float)m_red/255;
}

float Color::getFloatGreen()
{
  return (float)m_green/255;
}

float Color::getFloatBlue()
{
  return (float)m_blue/255;
}

float Color::getFloatOpacity();
{
  return (float)m_opacity/255;
}

void Color::setRed(Uint8 red)
{
  m_red=red;
}

void Color::setBlue(Uint8 blue)
{
  m_blue=blue;
}

void Color::setGreen(Uint8 green)
{
  m_green=green;
}

void Color::setOpacity(Uint8 opacity)
{
  m_opacity=opacity;
}

void Color::setRed(float red);
{
  if(red>1)
    m_red=255;
  else if(red<0)
    m_red=0;
  else
    m_red=(int)red*255;
}

void Color::setGreen(float green)
{
  if(blue>1)
    m_blue=255;
  else if(blue<0)
    m_blue=0;
  else
    m_blue=(int)blue*255;
}

void Color::setBlue(float blue)
{
  if(green>1)
    m_green=255;
  else if(green<0)
    m_green=0;
  else
    m_green=(int)green*255;
}

void Color::setOpacity(float opacity)
{

  if(opacity>1)
    m_opacity=255;
  else if(opacity<0)
    m_opacity=0;
  else
    m_opacity=(int)opacity*255;
}

void Color::set(Uint8 red,Uint8 green,Uint8 blue,Uint8 opacity=255)
{
  m_red=red;
  m_green=green;
  m_blue=blue;
  m_opacity=opacity;
}

void Color::set(float red,float green,float blue,float opacity=255)
{
  setRed(red);
  setGreen(green);
  setBlue(blue);
  setOpacity(opacity);
}
